from django.db import models
from rest_framework import serializers


# Create your models here.

class Price(models.Model):
    # resource = models.ForeignKey(Resource, on_delete=models.PROTECT, verbose_name='资源')  # 资源，外键关联Resource表
    # 土样有关参数
    name = models.CharField(max_length=200, null=True, verbose_name='名称')
    unit = models.CharField(max_length=200, null=True, verbose_name='单位')
    value = models.FloatField(null=True, verbose_name='数值')
    source = models.CharField(max_length=600, null=True, verbose_name="数据来源及依据")
    remark = models.CharField(max_length=600, null=True, verbose_name="备注")

    class Meta:
        db_table = 'price'


class PriceSerializer(serializers.ModelSerializer):
    class Meta:
        model = Price
        fields = '__all__'
